<template>
	<view class="ordercontent">
		<navBar title="订单详情"></navBar>

		<view class="product flex_center">
			<image :src="data.image" mode="aspectFill"></image>
			<view class="name hidden">
				<text>{{ data.title || '' }}</text>
				<view>
					<i>￥</i>{{ Number(data.pay_num) == 0 ? '免费' : data.pay_num }}
				</view>
			</view>
		</view>

		<view class="order_content_text flex_r_between">
			<text>发起人：</text>
			<view class="hidden">{{ data.nickname || '' }}</view>
		</view>

		<!-- 	<view class="order_content_text flex_r_between">
			<text>活动时间：</text>
			<view class="hidden">{{ data.active_time || '' }}</view>
		</view> -->

		<view class="order_content_text flex_r_between">
			<text>活动地址 ：</text>
			<view class="hidden_3">{{ data.active_city }}{{ data.active_district }}{{ data.active_address }}</view>
		</view>


		<view class="line"></view>

		<view class="order_content_text flex_r_between">
			<text>付款时间：</text>
			<view class="hidden">{{ data.apply_time }}</view>
		</view>

		<view class="order_content_text flex_r_between">
			<text>订单编号：</text>
			<view class="hidden">{{ data.order_sn }}</view>
		</view>

		<view class="order_content_text flex_r_between">
			<text>支付方式：</text>
			<view class="hidden">{{ data.pay_type == 1 ? '微信支付' : data.pay_type == 1 ? '支付宝支付' : '其他' }}</view>
		</view>

		<view class="btn flex_r_around" @click="toReturn"
			v-if="(data.status == 2 || data.status == 3) && (data.return_status == 1 || data.return_status == 4) && Number(data.pay_num) > 0">
			<text>退款</text>
		</view>

	</view>
</template>

<script>
	import navBar from '@//compentents/navBar/navBar.vue';
	export default {
		components: {
			navBar,
		},
		data() {
			return {
				id: 0,
				data: {},
			}
		},
		methods: {
			getDetail() {
				this.$get('/loyou/getApplyInfo', {
					apply_id: this.id
				}).then(res => {
					this.data = res.data;
				})
			},

			toReturn() {
				this.$util.toUrl(`/pages/order/activereturn?leyou_id=${this.data.loyou_id}&apply_id=${this.data.id}`);
			}
		},

		onLoad(option) {
			if (option.token) {
				uni.setStorageSync('token', option.token);
				uni.setStorageSync('cid', option.cid);
				uni.setStorageSync('terminal', option.terminal);
			}
			if (option.id) {
				this.id = option.id || 0;
				this.getDetail();
			}
		}
	}
</script>

<style lang="less" scoped>
	.ordercontent {
		padding: 32rpx 32rpx 168rpx;
		min-height: 100vh;
		background: #FFFFFF;
	}

	// 商品
	.product {
		image {
			width: 128rpx;
			height: 128rpx;
			border-radius: 16rpx;
			color: #ECECF4;
			margin-right: 20rpx;
		}

		.name {
			flex: 1;

			text {
				font-weight: 500;
				font-size: 32rpx;
				color: #131313;
			}

			view {
				i {
					font-size: 24rpx;
					font-style: normal;
				}

				font-weight: 600;
				font-size: 32rpx;
				color: #131313;
			}
		}

	}

	// 商品详情标签
	.line {
		height: 2rpx;
		background: #EEEEEE;
		margin-top: 32rpx;
	}

	.order_content_text {
		margin-top: 32rpx;

		text {
			font-size: 28rpx;
			color: #131313;
			width: 240rpx;
		}

		.price {
			font-weight: 600;
			font-size: 40rpx;
			color: #FD2A53;

			i {
				font-style: normal;
				font-size: 28rpx;
			}
		}

		.kefu {
			font-size: 28rpx;
			color: #999999;
		}

		view {
			flex: 1;
			text-align: right;
			font-size: 28rpx;
			color: #999999;

			text {
				font-size: 28rpx;
				color: #999999;
			}
		}
	}

	.btn {
		width: 686rpx;
		height: 88rpx;
		background: #FFFFFF;
		border-radius: 44rpx;
		border: 2rpx solid #CCCCCC;
		position: fixed;
		bottom: 30rpx;
		left: 32rpx;

		text {
			font-size: 28rpx;
			color: #131313;
		}
	}
</style>